<script type="text/javascript" src="js/api.js"></script>
<script>
var channelID = 52;

var mp = new MediaPlayer();
var nativePlayerInstanceId = mp.getNativePlayerInstanceID();
mp.setVideoDisplayMode(1);
mp.setVolume(40);
mp.setNativeUIFlag(1);
mp.setMuteUIFlag(1);
mp.refreshVideoDisplay();
mp.initMediaPlayer();

var tsurl = "rtsp://183.59.160.61/PLTV/88888888/224/3221226903/00000100000000060000000000480949_0.smil";
var zjtvurl = "rtsp://183.59.160.61/PLTV/88888888/224/0/3221225610/0000000007jf.smil";
var mediaStr = '[{mediaUrl:"'+ zjtvurl +'",';
mediaStr += 'mediaCode:"'+ 23 +'",';
mediaStr += 'mediaType:2,';
mediaStr += 'audioType:1,';
mediaStr += 'videoType:1,';
mediaStr += 'streamType:1,';
mediaStr += 'drmType:1,';
mediaStr += 'fingerPrint:0,';
mediaStr += 'copyProtection:1,';
mediaStr += 'allowTrickmode:1,';
mediaStr += 'startTime:0,endTime:20000,entryID:"jsonentry1"}]';

mp.setSingleMedia(mediaStr);
mp.playFromStart();



function showMuteIcon(){
    //$("muteIcon").style.background = "url(./image/mute_128.png)"
    $("muteIcon").style.display = "block";
}
function hideMuteIcon(){
    //$("muteIcon").style.visibility = "hidden";
    $("muteIcon").style.display = "none";
}

function playPause(){

}

function keyUp(){

}
function keyDown(){

}
function keyLeft(){

}
function keyRight(){

}
function volumeUp(){

}
function volumeDown(){

}
function channelUp(){

}
function channelDown(){

}

function vitualkeyEvent() {
    eval("eventJson = " + Utility.getEvent());
    var typeStr = eventJson.type;
    switch (typeStr) {
        case "EVENT_GO_CHANNEL":
           alert("go channel");
           break;
        case "EVENT_MEDIA_END":
            alert("end");
            break;
        case "EVENT_MEDIA_BEGIN":
            alert("begin");
            break;
        case "EVENT_MEDIA_ERROR":
            alert("error");
            break;
        case "EVENT_PLAYMODE_CHANGE":
            alert("change");
            break;
        case "EVENT_REMINDER":
            alert("reminder");
            break;
        case "EVENT_JVM_CLIENT":
            alert("jvm client");
            break;
        default:
            return true;
            break;
    }
}


function keyEventHandle(keyEvent) {
	keyEvent = keyEvent ? keyEvent : window.event;
    keyEvent.which = keyEvent.which ? keyEvent.which : keyEvent.keyCode;
	switch(keyEvent.which) {
    case 768:
        vitualkeyEvent();
        break;

	case 265:  //volume channel
        alert("265");
        audioTrack();
		break;
	case 261: //mute
        pageMute();
		break;
    case 262: // ??? setting
		break;
    case 0: //cycle
		break;

	case 275: //live
		break;
	case 276: //look back
		break;
	case 277: //demand
		break;
	case 278: //message
		break;

	case 272: //homepage
		break;
    case 273: //local
	    break;
	case 263: //play/stop
        playPause();
		break;
	case 8: //back
        back();
		break;

	case 38: //up
        keyUp();
		break;
	case 40: //down
        keyDown();
		break;
	case 37: //left
        keyLeft();
		break;
	case 39: //right
        keyRight();
		break;

	case 259: //volume+
        volumeMagnify();
		break;
	case 260: //volume-
        volumeMinish();
		break;
	case 33: //page up
		break;
	case 34: //page down
		break;
	case 257: //channel+
        channelUp();
		break;
	case 258: //channel-
        channelDown();
		break;

    default:
        return false;
		break;
	}
}
window.document.onkeypress = keyEventHandle;
</script>

<body bgcolor="transparent">
<div id="muteIcon" style="position:absolute; left:1100px; top:128px; left: 128px; line-height: 128px; width:128px; background: url(image/mute_128.png)" >
</div>


</body>
